(0x80040E07)[Microsoft][ODBC Microsoft Acce Driver] 标准表达式中数据类型不匹配。/gmxx.asp, 第 41 行

来源:百度知道 编辑:UC知道 时间:2024/06/21 09:01:27
代码如下 希望高手帮忙下 谢谢了
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/xw.asp" -->
<%
Dim ssjg__MMColParam
ssjg__MMColParam = "1"
If (Request.Form("sou") <> "") Then
ssjg__MMColParam = Request.Form("sou")
End If
%>
<%
Dim ssjg
Dim ssjg_numRows

Set ssjg = Server.CreateObject("ADODB.Recordset")
ssjg.ActiveConnection = MM_xw_STRING
ssjg.Source = "SELECT * FROM doc WHERE nr ORDER BY tjtime DESC"
ssjg.CursorType = 0
ssjg.CursorLocation = 2
ssjg.LockType = 1
ssjg.Open()

ssjg_numRows = 0
%>
<%
Dim gmxx__MMColParam
gmxx__MMColParam = "1"
If (session("mm_username") <> "") Then
gmxx__MMColParam = session("mm_username")
End If
%>
<%
Dim gmxx

gmxx.Source = "SELECT * FROM gw WHERE hy = " + Replace(gmxx__MMColParam, "'", "''") + " ORDER BY ddtime DESC"
后面 加
response.write("SELECT * FROM gw WHERE hy = " + Replace(gmxx__MMColParam, "'", "''") + " ORDER BY ddtime DESC")
response.end()
运行一下看看输出的sql语句
估计是数据库中hy的数据类型的原因,如果hy是字符型的话 应该是这样的
"SELECT * FROM gw WHERE hy = '" + Replace(gmxx__MMColParam, "'", "''") + "' ORDER BY ddtime DESC"

gmxx.Source = "SELECT * FROM gw WHERE hy = " + Replace(gmxx__MMColParam, "'", "''") + " ORDER BY ddtime DESC"

这句,左边是一个datasource,右边是一个字符串,怎么可能赋值呢?类型当然就不一样了呗,呵呵